#!/bin/bash
# curl.sh
# **********************************************************************
# This program is part of the source code released for the Swap example
#  (c) Author: Wyther Yang
#  GitHub repository:
#  https://github.com/wythers/ioCoro
# **********************************************************************
# Brief Description:
#
# Query the car price through several swaps.
name=$(basename "$0")

usage()
{
 echo "Usage: ${name} TypeOfCar
        - Only provide the car type; the ${name} will get the price
          from the server after several swapers. But the server keeps a limited price list, 
          and the types of cars that are not in this price list are unknown.

        - The list is:
                jeep    : \$20.000
                SUV     : \$30.000
                van     : \$40000
                vehicle : \$50.000 

        - for examples:
                $ ./query jeep
                $ ./query van"
}

[ $# -ne 1 ] && {
 usage
 exit 1
}

./answerer 1>/dev/null &

echo "Wait for the server to be ready..."
sleep 1

./asker $1

kill %1

exit 0

